<template>
  <div class="list">
    <ul class="com">
      <li v-for="item in list" :key="item.trackid">
        <a>
          <div class="tc_item" @click="goSound(item.trackid)">
            <div class="icon">
              <van-icon name="play-circle-o" />
            </div>
            <div class="title">{{ item.title }}</div>
          </div>
        </a>
      </li>
    </ul>
    <div class="add_load">
      <p>
        <a @click="addLoadMore"
          >{{ list.length >= totalCount ? "没有更多了":"加载更多"
          }}<van-icon name="arrow-down"
        /></a>
      </p>
    </div>
  </div>
</template>

<script>
import { initAlbumListData } from "@/request/api.js";
export default {
  data() {
    return {
        page:1
    };
  },
  props: {
    albumId: {
      type: Number,
    },
    list: {
      type: Array,
    },
    totalCount:{
        type:Number
    }
  },
  created() {
    // this.initData()
  },
  methods: {
    goSound(id) {
      this.$router.push("/sound/" + id);
      this.$router.go(0);
      this.$router.push("/sound/" + id);
    },
    addLoadMore(){
        if(this.list.length >= this.totalCount){
            return
        }
        this.page++
        this.$emit('add-more',this.page)
    }
  },
};
</script>

<style lang="scss" scoped>

.list{
background-color: #fff;

}
.com {
    
  padding-left: 15px;
  li {
    a {
      display: block;
      .tc_item {
        display: flex;
        align-items: center;
        padding: 12px 0;
        border-bottom: 1px solid #f3f4f5;
        .icon {
          font-size: 30px;
          color: #333;
        }
        .title {
          white-space: nowrap;
          text-overflow: ellipsis;
          overflow: hidden;
          font-size: 16px;
          color: #333;
          padding-left: 8px;
          width: 270px;
        }
      }
    }
  }
}
.add_load {
  p {
    text-align: center;
    a {
      line-height: 1.4;
      font-size: 15px;
      color: #f86442;
      font-weight: 700;
      i {
        margin-left: 5px;
      }
    }

    padding: 17px 0;
  }
}
</style>

